package com.feihe.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    // 移除CORS配置，因为现在测试页面和API在同一个域下，不需要跨域配置
    
    @Override
    public void addResourceHandlers(@NonNull ResourceHandlerRegistry registry) {
        // 配置QR码静态资源访问
        registry.addResourceHandler("/qrcode/**")
                .addResourceLocations("file:qrcode/");
                
        // 配置HTML测试页面等静态资源访问
        registry.addResourceHandler("/testapi.html", "/index.html", "/calendar.html", "/list.html", "/debug.html", "/static/**")
                .addResourceLocations("classpath:/static/")
                .setCachePeriod(0); // 开发时禁用缓存，便于调试
    }
} 